Extreme C by Kamran Amini
Author:Kamran Amini [Amini, Kamran]
Language: eng
Format: epub, pdf
Tags: COM051060 - COMPUTERS / Programming Languages / C, COM051010 - COMPUTERS / Programming Languages / General, COM051000 - COMPUTERS / Programming / General
Publisher: Packt Publishing
Published: 2019-10-31T09:27:39+00:00
Processes and threads
Throughout this book, we are mainly interested in task scheduling within computer systems. In an operating system, tasks are either processes or threads. We'll explain them and their differences in the upcoming chapters, but for now, you should know that most operating systems treat both in basically the same way: as some tasks that need to be executed concurrently.
An operating system needs to use a task scheduler to share the CPU cores among the many tasks, be they processes or threads, that are willing to use the CPU for their execution. When a new process or a new thread is created, it enters the scheduler queue as a new task, and it waits to obtain a CPU core before it starts running.
In cases in which a time-sharing or preemptive scheduler is in place, if the task cannot finish its logic in a certain amount of time, then the CPU core will be taken back forcefully by the task scheduler and the task enters the queue again, just like in the telephone booth scenario.
In this case, the task should wait in the queue until it obtains the CPU core once more, and then it can continue running. If it cannot finish its logic in the second round, the same process continues until it is able to finish.
Every time a preemptive scheduler stops a process in the middle of running and puts another process into the running state, it is said that a context switch has occurred. The faster the context switches are, the more a user will feel as if the tasks are being run in parallel. Interestingly, most operating systems today use a preemptive scheduler, something that will be our main focus for the rest of this chapter.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12592)
Hello! Python by Anthony Briggs(9928)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9803)
The Mikado Method by Ola Ellnestam Daniel Brolund(9787)
Dependency Injection in .NET by Mark Seemann(9348)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8310)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7772)
Grails in Action by Glen Smith Peter Ledbrook(7705)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7567)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7173)
Microservices with Go by Alexander Shuiskov(6943)
Practical Design Patterns for Java Developers by Miroslav Wengner(6857)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6801)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6424)
Angular Projects - Third Edition by Aristeidis Bampakos(6217)
The Art of Crafting User Stories by The Art of Crafting User Stories(5735)
NetSuite for Consultants - Second Edition by Peter Ries(5663)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5479)
Kotlin in Action by Dmitry Jemerov(5074)
